/*
============================================================================
 Name        : ImageTool.h
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : CImageTool declaration
============================================================================
*/

#ifndef IMAGETOOL_H
#define IMAGETOOL_H

#include <e32base.h>	// For CActive, link against: euser.lib
#include <e32std.h>		// For RTimer, link against: euser.lib

class CImageDecoder;
class CFbsBitmap;
class CBitmapScaler;

class MImageToolObserver
{
public:
	//virtual void DecodeCompleted() = 0;
	virtual void ScaleCompleted() = 0;
};

class CImageTool : public CActive
{
public:
	static CImageTool* NewL(MImageToolObserver* aObserver);

	static CImageTool* NewLC(MImageToolObserver* aObserver);

	// C++ constructor
	CImageTool(MImageToolObserver* aObserver);
	
	// Second-phase constructor
	void ConstructL();
	
	// Cancel and destroy
	~CImageTool();

public: // New functions
	// Function for making the initial request
	void CImageTool::StartDecodeL(const TDesC8& aData,CFbsBitmap*& aBmp);

	static void CreateFbsBmpFromPng(const TDesC &aFilepath, CFbsBitmap*& aBitmap, CFbsBitmap*& aBmpMask);

private: // From CActive
	// Handle completion
	void RunL();
	
	// How to cancel me
	void DoCancel();

public:
	enum TState 
	{
		EIdle = 0,
		EDecoding,
		//EScaling
	};
private:
	CImageDecoder*		iImageDecoder;
	MImageToolObserver* iObserver;
	TInt iState;
	HBufC8* iImgData;
};

#endif
